2 ############################################################
4 # author: devenkong(18151155@qq.com)
6 ############################################################
7 # Copyright (C) 2022- Free Software Foundation, Inc.
8 # This configure script is free software; the Free Software
9 # Foundation gives unlimited permission to copy, distribute
11 ############################################################
13 # this is a test shlib file for nest include testing. env
14 # var and function can work in nest include.
15 ############################################################
28 dbgout
"load uniq3.shlib at the beginning ...\n"
31 # this cmd enable alias feature in script. it is disabled in default.
32 shopt -s expand_aliases
35 # global variable re-init if this shlib has been loaded.
36 # and the code after 'uniqlib' will not be loaded repeatly.
37 # invoke PROG_GVAR_INIT before 'uniqlib'.
38 # if this shlib has not been loaded, uniqlib will not skip
39 # loading code after it.
41 echo -ne "PROG_GVAR_INIT uniq3\n"
42 PROG_GVAR_INIT uniq3.shlib
44 echo -ne "uniqlib uniq3\n"
47 echo -ne "normal init invoke.\n"
49 ##############################
50 # section: shlib include
51 ##############################
57 ##############################
58 # section: public comment info
59 ##############################
62 ##############################
63 # section: variable define
64 ##############################
68 # global variable init.
69 if [[ ! -v TEST_UNIQ3
]]; then
72 TEST_UNIQ3
=$
(( TEST_UNIQ3
+ 1 ))
75 # global exported variable init.
76 if [[ ! -v TEST_INC_CNT
]]; then
77 declare -g -x TEST_INC_CNT
=1
79 TEST_INC_CNT
=$
(( TEST_INC_CNT
+ 1 ))
82 dbgout
"shlib_uniq3_init() is invoked in uniq3.shlib!\n"
83 dbgout
"TEST_UNIQ3 defined in uniq3.shlib is '$TEST_UNIQ3'.\n"
84 dbgout
"TEST_INC_CNT defined in uniq.shlib is '$TEST_INC_CNT'.\n"
85 dbgout
"TEST_INC_CNT is $TEST_INC_CNT, it is exported by parent process.\n"
88 # this func will be invoke in first inclussion.
92 # global variable init function invoking.
93 # invoke GVAR_INIT if it is running at first time.
95 #GVAR_INIT uniq3.shlib
98 ##############################
99 # section: private function
100 ##############################
104 ##############################
105 # section: public function
106 ##############################
109 # fsyntax: uniq_test_func3
110 # fdesc: this is a test func for uniq testing.
114 dbgout
"uniq_test_func3(TEST_UNIQ3=$TEST_UNIQ3, TEST_INC_CNT=$TEST_INC_CNT) is invoked in uniq3.shlib.\n"
117 alias uniq_test_alias3
="dbgout \"uniq_test_alias3() is an example in uniq3.shlib.\n\""
120 dbgout
"load uniq3.shlib at the tail ...\n"
122 ######################
124 ######################